package practice07;

import java.util.Objects;

public class Student extends Person{
    private Klass klass;
    public Student(String name, int age) {
        super(name, age);
    }

    public Student(String name, int age, Klass klass) {
        super(name, age);
        this.klass =klass;
    }

    public Klass getKlass() {
        return klass;
    }

    public void setKlass(Klass klass) {
        this.klass = klass;
    }

    public String introduce() {
        String string ="My name is "+getName()+". I am "+getAge()+" years old. I am a Student. I am at Class "+getKlass().getNumber()+".";
        return string;
    }

    @Override
    public String toString() {
        return "Student{" +
                "klass=" + klass +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(klass, student.klass);
    }

    @Override
    public int hashCode() {
        return Objects.hash(klass);
    }
}
